import request from '@/sheep/request';

const AuthUtil = {
  // 使用账号 + 密码登录
  login: (data) => {
    return request({
      url: '/tire/auth/store-login',
      // url: '/system/auth/login',
      method: 'POST',
      data,
      custom: {
        showSuccess: true,
        loadingMsg: '登录中',
        successMsg: '登录成功',
      },
    });
  },
  // 使用手机 + 密码登录
  getInfo: () => {
    return request({
      url: '/system/auth/get-permission-info',
      method: 'GET',
    });
  },
  // 使用手机 + 密码登录
  logout: (data) => {
    return request({
      url: '/system/auth/logout',
      method: 'GET',
      data,
      custom: {
        showSuccess: true,
        loadingMsg: '退出中',
        successMsg: '退出成功',
      },
    });
  },
  // 刷新令牌
  refreshToken: (refreshToken) => {
    return request({
      url: '/tire/auth/store-refresh-token',
      method: 'POST',
      params: {
        refreshToken
      },
      custom: {
        loading: false, // 不用加载中
        showError: false, // 不展示错误提示
      },
    });
  },
};

export default AuthUtil;
